home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Paint v7.1
/
Cloanto Personal Paint v7.1.iso
/
rexx
/
giftopng.pprx
< prev
next >
Wrap
Text File
|
1997-05-06
|
12KB
|
311 lines
/* Personal Paint Amiga Rexx script - Copyright ⌐ 1995-1997 Cloanto Italia srl */
/* $VER: GifToPng.pprx 1.1 */
/** ENG
This script asks the user to specify a directory, scans the directory
and its subdirectories and converts all GIF files it finds into PNG.
Non-GIF files are not affected. Icon images are preserved. Icon format
information is updated (Tool Types: FILETYPE=PNG). GIF Author, Copyright
and Comment fields are translated to PNG equivalents. File name suffixes
are changed (i.e. the files are renamed) as follows:
á .gif -> .png
á .GIF -> .PNG
á .Gif -> .Png, etc.
á others -> unchanged
Personal Paint identifies the file type by its contents (not by the file
name suffix). If the script runs during Workbench use, the Workbench Update
menu item must be selected to visually update the contents of any windows
containing files being renamed by this script.
This script requires Personal Paint version 7.0 (PPaint Rexx version 7)
or higher, personal_png_io.library (enclosed with PPaint), and
personal_gif_io.library (or another GIF-compatible library).
Possible changes that could be applied to this file:
Convert all images to PNG (not just GIFs). To do this, change the line
selecting GIFs to IF UPPER(RESULT) ~= 'PNG' THEN DO. However, be careful
if you have IFF animations, as they can be loaded as ILBM images unless
they are filtered out (IFF animations begin with an ILBM image).
Activate PNG Adam 7 progressive display in files being written. This
degrades compression but the resulting images appear more nicely when
displayed by progressive viewers. Set PROGDSP=1.
Convert any file to uncompressed IFF-ILBM. This may be good for files to
be stored on an Amiga CD-ROM, where loading speed could be more important
than compression. Remove the instructions selecting only GIFs and replace
the PNG FORMAT option with FORMAT ILBM OPTIONS "COMPR=0" "SCRFMT=0".
PNG was designed as a replacement and extension to GIF and LZW-based TIFF,
after Unisys Corporation began demanding royalties on GIF/LZW code. As
the PNG specification was released in May 1995, it gained general
recognition as the best lossless standard for storing digital images.
Cloanto, the first software house to publish a paint program supporting the
PNG file format, is also making available a PNG developer's kit for the
Amiga (on the Personal Suite CD-ROM). A PNG DataType is available at no
cost for free electronic distribution.
*/
/** DEU
Die GIF-Bilder im angegebenen Verzeichnis (und in dessen
Unterverzeichnissen) lassen sich mit Hilfe dieses Skripts automatisch in
PNG-Bilder umwandeln.
Nicht im GIF-Format vorliegende Bilder werden nicht berⁿcksichtigt;
Icon-Dateien bleiben grundsΣtzlich unverΣndert, allerdings werden die
Formatinformationen der FormatΣnderung angepa▀t (Merkmale: FILETYPE=PNG).
Au▀erdem die durch das GIF-Format unterstⁿtzten Felder fⁿr Autor,
Copyright und Kommentar ihren PNG-─quivalenten angepa▀t. Evtl. vorhandene
Dateinamenerweiterungen werden durch Umbenennung wie folgt geΣndert:
á .gif -> .png
á .GIF -> .PNG
á .Gif -> .Png, usw.
á andere -> unverΣndert
Personal Paint identifiziert das Dateiformat anhand des Dateiinhalts,
und nicht etwa anhand der Dateinamenerweiterung. Wenn dieses Skript
wΣhrend der Benutzung der Workbench ausgefⁿhrt wird, mu▀ zunΣchst
der Menⁿbefehl "alles aktualisieren" im Menⁿ "Workbench" ausgefⁿhrt werden,
um den Inhalt von Fenstern zu aktualisieren, die von diesem Skript
modifizierte Dateien enthalten.
Dieses Skript erfordert Personal Paint 7.0 (PPaint Rexx Version 7)
oder h÷her, die personal_png_io.library (im Lieferumfang von PPaint
enthalten) und die personal_gif_io.library (oder eine andere
GIF-kompatible Library).
Denkbare ─nderungen an dieser Skriptdatei:
Konvertierung sΣmtlicher Bilder (nicht nur GIF) in das PNG-Format.
Dazu ist die Zeile zur Auswahl der GIF-Bilder in
IF UPPER(RESULT) ~='PNG' THEN DO zu Σndern. Hierbei ist im Hinblick
auf das Vorhandensein von Animationen im IFF-Format Vorsicht
walten zu lassen, da auch diese sich als ILBM-Bilder laden lassen
(IFF-Animationen beginnen mit einem ILBM-Bild).
Aktivierung der "PNG Adam 7 progressive Display"-Option beim Speichern
der Dateien. Dies fⁿhrt zwar zu einer verringerten Komprimierungsrate,
bewirkt aber bei der Anzeige mit einem geeigneten Programme eine
eine optimierte Darstellung. Set PROGDSP=1.
Konvertierung einer beliebigen Grafikdatei in das umkomprimierte
IFF-ILBM-Format. Dies kann besonders fⁿr Dateien sinnvoll sein, die auf
einer speziell fⁿr den Amiga entwickelten CD-ROM gespeichert werden
sollen, und wenn die Ladegeschwindigkeit eine h÷here PrioritΣt genie▀t
als die Komprimierungsrate. Entfernen Sie einfach die Befehle, die
die Auswahl lediglich auf GIF-Bilder beschrΣnken, und ersetzen Sie die
Option PNG FORMAT durch FORMAT ILBM OPTIONS "COMPR=0" "SCRFMT=0".
Das PNG-Format wurde als Ersatz und Erweiterung zu GIF und dem
LZW-basierten TIFF-Format entwickelt, nachdem deren Eigentⁿmer, die
Firma Unisys, fⁿr die Verwendung des GIF-/LZW-Codes Gebⁿhren forderte.
Kurz nach der Ver÷ffentlichung der PNG-Spezifikation im Mai 1995
geno▀ das Format bereits allgemeine Anerkennung als bester verlustfreier
Standard zur digitalen Bildspeicherung.
Cloanto, die Entwickler des ersten Malprogramms mit PNG-Unterstⁿtzung,
sind auch die Herausgeber des PNG-Entwicklerpakets fⁿr den Amiga
(erhΣltlich auf der Personal Suite CD-ROM). ZusΣtzlich ist gratis ein
PNG-DataType erhΣltlich, der auf elektronischem Wege frei verteilt werden
darf.
*/
/** ITA
Questo script chiede all'utente di indicare un cassetto, che viene
poi esaminato insieme agli altri cassetti in esso contenuti per convertire
tutti i file GIF trovati in file PNG.
File non-GIF non sono modificati. Le immagini delle icone sono conservate.
Le informazioni dell'icona relative al formato sono aggiornate (Parametri:
FILETYPE=PNG). I campi Autore, Copyright e Commenti di GIF sono tradotti
negli equivalenti di PNG. Sono modificati i suffissi del nome file (i file
sono rinominati) come segue:
á .gif -> .png
á .GIF -> .PNG
á .Gif -> .Png, ecc.
á altri -> invariati
Personal Paint identifica il tipo del file dal suo contenuto (non dal
suffisso del nome file). Se si avvia lo script durante l'uso del Workbench,
si deve selezionare la voce di menu Workbench/Aggiornare tutto per poter
aggiornare la visualizzazione del contenuto di ogni finestra contenente file
rinominati da questo script.
Questo script richiede Personal Paint versione 7.0 (PPaint Rexx versione 7)
o successivo, personal_png_io.library (acclusa a PPaint), e
personal_gif_io.library (o altra libreria GIF-compatibile).
Possibili modifiche apportabili a questo file:
Convertire tutte le immagini in PNG (not solo quelle GIF). Per fare ci≥,
basta cambiare le linea per la selezione delle immagini GIF in
IF UPPER(RESULT) ~= 'PNG' THEN DO. Bisogna per≥ fare attenzione se si
hanno animazioni IFF, poichΘ possono essere caricate come immagini ILBM
a meno che non si usi un filtro di esclusione (le animazioni IFF iniziano
con una immagine ILBM).
Attivare la visualizzazione progressiva PNG Adam 7 nei file che sono
via via salvati. Ci≥ peggiora i risultati della compressione ma le
immagini cos∞ ottenute appaiono molto pi∙ elegantemente quando sono
mostrate da visualizzatori progressivi. Impostare PROGDSP=1.
Convertire ogni file in IFF-ILBM non compresso. Ci≥ pu≥ essere utile per
file da immagazzinare su un CD-ROM per Amiga, dove la velocitα di
caricamento potrebbe essere pi∙ importante della compressione. Rimuovere
le sitruzioni che selezionano solo immagini GIF e sostituire l'opzione
PNG FORMAT con FORMAT ILBM OPTIONS "COMPR=0" "SCRFMT=0".
PNG Φ stato progettato come sostituto ed estensione per GIF e TIFF LZW-based,
dopo che Unisys Corporation inizi≥ a chiedere royalties sul codice GIF/LZW.
Da quando le specifiche PNG furono rilasciate nel Maggio 1995, il formato
ottenne riconoscimenti diffusi come il miglior standard di immagazzinamento
per immagini digitali senza perdita di informazioni.
Cloanto, la prima software house a pubblicare un programma di disegno che
consente l'uso del formato PNG, rende disponibile un kit PNG per
sviluppatori (sul CD-ROM Personal Suite). Un DataType PNG Φ
disponibile senza alcun costo via Internet.
*/
IF ARG(1, EXISTS) THEN
PARSE ARG PPPORT
ELSE
PPPORT = 'PPAINT'
IF ~SHOW('P', PPPORT) THEN DO
IF EXISTS('PPaint:PPaint') THEN DO
ADDRESS COMMAND 'Run >NIL: PPaint:PPaint'
DO 30 WHILE ~SHOW('P',PPPORT)
ADDRESS COMMAND 'Wait >NIL: 1 SEC'
END
END
ELSE DO
SAY "Personal Paint could not be loaded."
EXIT 10
END
END
IF ~SHOW('P', PPPORT) THEN DO
SAY 'Personal Paint Rexx port could not be opened'
EXIT 10
END
ADDRESS VALUE PPPORT
OPTIONS RESULTS
OPTIONS FAILAT 10000
Get 'LANG'
IF RESULT = 1 THEN DO /* Deutsch */
txt_req_sel = 'GifToPng-Zielverzeichnis'
txt_err_svabort = 'Speichervorgang wurde abgebrochen'
txt_err_ldabort = 'Ladevorgang wurde abgebrochen'
txt_err_save = 'Fehler beim Speichern: '
txt_err_load = 'Fehler beim Laden: '
txt_err_oldclient = 'Fⁿr dieses Skript_ist eine neuere Version_von Personal Paint erforderlich'
END
ELSE IF RESULT = 2 THEN DO /* Italiano */
txt_req_sel = 'Selezionare cassetto'
txt_err_svabort = 'Scrittura annullata'
txt_err_ldabort = 'Lettura annullata'
txt_err_save = 'Errore nella scrittura: '
txt_err_load = 'Errore nella lettura: '
txt_err_oldclient = 'Questa procedura richiede_una versione pi∙ recente_di Personal Paint'
END
ELSE DO /* English */
txt_req_sel = 'GifToPng target directory'
txt_err_svabort = 'User abort during save'
txt_err_ldabort = 'User abort during load'
txt_err_save = 'Error during save: '
txt_err_load = 'Error during load: '
txt_err_oldclient = 'This script requires a newer_version of Personal Paint'
END
Version 'REXX'
IF RESULT < 7 THEN DO
RequestNotify 'PROMPT "'txt_err_oldclient'"'
EXIT 10
END
LockGUI
FreeBrush
IF RC = 0 THEN
RequestPath '"'txt_req_sel'"'
IF RC = 0 THEN DO
tmpfname = 'T:pprx_temp.'PRAGMA('ID')
ADDRESS COMMAND 'List >'tmpfname' 'RESULT' NOHEAD PAT=~(#?.info) LFORMAT="*"%s%s*"" ALL FILES'
IF OPEN('listfile', tmpfname, 'R') THEN DO
Get 'ICONS'
iconmode = RESULT
errcode = 0
Set '"ICONS=3"'
DO FOREVER
curfname = READLN('listfile')
IF EOF('listfile') THEN BREAK
GetFileFormat curfname
IF RC = 0 THEN DO
IF UPPER(RESULT) = 'GIF' THEN DO
LoadBrush curfname 'FORCE'
IF RC = 0 THEN DO
IF UPPER(RIGHT(curfname, 5)) = '.GIF"' THEN DO
len = LENGTH(curfname)
newfname = OVERLAY(D2C(C2D(SUBSTR(curfname, len-3, 1)) + 9), curfname, len-3)
newfname = OVERLAY(D2C(C2D(SUBSTR(curfname, len-2, 1)) + 5), newfname, len-2)
newfname = OVERLAY(D2C(C2D(SUBSTR(curfname, len-1, 1)) + 1), newfname, len-1)
IF EXISTS(SUBSTR(newfname,2,len-2)) = 0 THEN DO
ADDRESS COMMAND 'Rename >NIL: 'curfname' 'newfname
curiconfname = INSERT('.info', curfname, len-1)
newiconfname = INSERT('.info', newfname, len-1)
curfname = newfname
IF EXISTS(SUBSTR(curiconfname,2,len+3)) THEN DO
IF EXISTS(SUBSTR(newiconfname,2,len+3)) THEN
ADDRESS COMMAND 'Delete >NIL: 'curiconfname
ELSE
ADDRESS COMMAND 'Rename >NIL: 'curiconfname' 'newiconfname
END
END
END
SaveBrush 'FORCE FILE 'curfname' FORMAT PNG OPTIONS "PROGDSP=0" "COMPR=6" "AUTO=1"'
IF RC > 0 THEN DO
errcode = RC
IF RC = 5 THEN
errmess = txt_err_svabort
ELSE
errmess = txt_err_save || RC
END
FreeBrush 'FORCE'
END
ELSE DO
errcode = RC
IF RC = 5 THEN
errmess = txt_err_ldabort
ELSE
errmess = txt_err_load || RC
END
END
END
IF errcode > 0 THEN
BREAK
END
IF errcode > 0 THEN
RequestNotify 'PROMPT "'errmess'"'
Set '"ICONS='iconmode'"'
CALL CLOSE('listfile')
END
ADDRESS COMMAND 'Delete >NIL: 'tmpfname
END
UnlockGUI